home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 26.zip / BS1 part 26 / Aztec C v5.2a disk 4.adf / 204inc_i.lzh / rexx / storage.i < prev   
Text File  |  1991-03-14  |  10KB  |  242 lines

  1.      IFND REXX_STORAGE_I
  2. REXX_STORAGE_I SET    1
  3. **
  4. **    $Filename: rexx/storage.i $
  5. **    $Release: 2.04 $
  6. **    $Revision: 1.6 $
  7. **    $Date: 90/11/02 $
  8. **
  9. **    Include file for REXX data structures and memory/storage management.
  10. **
  11. **    (C) Copyright 1986,1987,1988,1989,1990 William S. Hawes.
  12. **        All Rights Reserved
  13. **
  14.  
  15.      IFND EXEC_TYPES_I
  16.      INCLUDE "exec/types.i"
  17.      ENDC
  18.  
  19.      IFND EXEC_NODES_I
  20.      INCLUDE "exec/nodes.i"
  21.      ENDC
  22.  
  23.      IFND EXEC_LISTS_I
  24.      INCLUDE "exec/lists.i"
  25.      ENDC
  26.  
  27.      IFND EXEC_PORTS_I
  28.      INCLUDE "exec/ports.i"
  29.      ENDC
  30.  
  31.      IFND EXEC_LIBRARIES_I
  32.      INCLUDE "exec/libraries.i"
  33.      ENDC
  34.  
  35. * The NexxStr structure is used to maintain the internal strings in REXX.
  36. * It includes the buffer area for the string and associated attributes.
  37. * This is actually a variable-length structure; it is allocated for a
  38. * specific length string, and the length is never modified thereafter
  39. * (since it's used for recycling).
  40.  
  41.          STRUCTURE NexxStr,0
  42.          LONG     ns_Ivalue            ; integer value
  43.          UWORD    ns_Length            ; length in bytes (excl null byte)
  44.          UBYTE    ns_Flags             ; attribute flags
  45.          UBYTE    ns_Hash              ; sum-of-characters hash code
  46.          STRUCT   ns_Buff,8            ; buffer area for strings
  47.          LABEL    NSMINSIZE            ; 16 bytes (minimum)
  48.  
  49. NXADDLEN EQU      ns_Buff+1            ; structure offset plus null byte
  50. IVALUE   EQU      ns_Ivalue            ; integer value
  51.  
  52. * String attribute flag bit definitions
  53. NSB_KEEP    EQU   0                    ; permanent string? (in Symbol Table)
  54. NSB_STRING  EQU   1                    ; string form valid?
  55. NSB_NOTNUM  EQU   2                    ; non-numeric?
  56. NSB_NUMBER  EQU   3                    ; a valid number?
  57. NSB_BINARY  EQU   4                    ; integer value saved?
  58. NSB_FLOAT   EQU   5                    ; floating point format?
  59. NSB_EXT     EQU   6                    ; an external string?
  60. NSB_SOURCE  EQU   7                    ; part of the program source?
  61.  
  62. * The flag form of the string attributes
  63. NSF_KEEP    EQU   1<<NSB_KEEP
  64. NSF_STRING  EQU   1<<NSB_STRING
  65. NSF_NOTNUM  EQU   1<<NSB_NOTNUM
  66. NSF_NUMBER  EQU   1<<NSB_NUMBER
  67. NSF_BINARY  EQU   1<<NSB_BINARY
  68. NSF_FLOAT   EQU   1<<NSB_FLOAT
  69. NSF_EXT     EQU   1<<NSB_EXT
  70. NSF_SOURCE  EQU   1<<NSB_SOURCE
  71.  
  72. * Combinations of flags
  73. NSF_INTNUM  EQU   (NSF_NUMBER!NSF_BINARY!NSF_STRING)
  74. NSF_DPNUM   EQU   (NSF_NUMBER!NSF_FLOAT)
  75. NSF_ALPHA   EQU   (NSF_NOTNUM!NSF_STRING)
  76. NSF_OWNED   EQU   (NSF_SOURCE!NSF_EXT!NSF_KEEP)
  77. KEEPSTR     EQU   (NSF_STRING!NSF_SOURCE!NSF_NOTNUM)
  78. KEEPNUM     EQU   (NSF_STRING!NSF_SOURCE!NSF_NUMBER!NSF_BINARY)
  79.  
  80. * The RexxArg structure is identical to the NexxStr structure, but
  81. * is allocated from system memory rather than from internal storage.
  82. * This structure is used for passing arguments to external programs.
  83. * It is usually passed as an "argstring", a pointer to the string buffer.
  84.  
  85.          STRUCTURE RexxArg,0
  86.          LONG     ra_Size              ; total allocated length
  87.          UWORD    ra_Length            ; length of string
  88.          UBYTE    ra_Flags             ; attribute flags
  89.          UBYTE    ra_Hash              ; hash code
  90.          STRUCT   ra_Buff,8            ; buffer area
  91.          LABEL    RexxArg_SIZEOF       ; size: 16 bytes
  92. ; Changed to RexxArg_SIZEOF from ra_SIZEOF
  93.  
  94. * The RexxMsg structure is used for all communications with Rexx programs.
  95. * It is an EXEC message with a parameter block appended.
  96.  
  97.          STRUCTURE RexxMsg,MN_SIZE
  98.          APTR     rm_TaskBlock         ; pointer to RexxTask structure
  99.          APTR     rm_LibBase           ; library pointer
  100.          LONG     rm_Action            ; command (action) code
  101.          LONG     rm_Result1           ; return code
  102.          LONG     rm_Result2           ; secondary result
  103.          STRUCT   rm_Args,16*4         ; argument block (ARG0-ARG15)
  104.          APTR     rm_PassPort          ; forwarding port
  105.          APTR     rm_CommAddr          ; host address (port name)
  106.          APTR     rm_FileExt           ; file extension
  107.          LONG     rm_Stdin             ; input stream
  108.          LONG     rm_Stdout            ; output stream
  109.          LONG     rm_avail             ; future expansion
  110.          LABEL    RMSIZEOF             ; size: 128 bytes
  111. ; Ranamed from rm_SIZEOF
  112.  
  113. * Field definitions
  114. ACTION   EQU      rm_Action            ; action code
  115. RESULT1  EQU      rm_Result1           ; primary return/error level
  116. RESULT2  EQU      rm_Result2           ; secondary return/result string
  117. ARG0     EQU      rm_Args              ; start of argblock
  118. ARG1     EQU      rm_Args+4            ; first argument
  119. ARG2     EQU      rm_Args+8            ; second argument
  120.  
  121. MAXRMARG EQU      15                   ; maximum arguments
  122.  
  123. * Command (action) codes for message packets
  124. RXCOMM   EQU      $01000000            ; a command-level invocation
  125. RXFUNC   EQU      $02000000            ; a function call
  126. RXCLOSE  EQU      $03000000            ; close the port
  127. RXQUERY  EQU      $04000000            ; query for information
  128. RXADDFH  EQU      $07000000            ; add a function host
  129. RXADDLIB EQU      $08000000            ; add a function library
  130. RXREMLIB EQU      $09000000            ; remove a function library
  131. RXADDCON EQU      $0A000000            ; add/update a ClipList string
  132. RXREMCON EQU      $0B000000            ; remove a ClipList string
  133. RXTCOPN  EQU      $0C000000            ; open the trace console
  134. RXTCCLS  EQU      $0D000000            ; close the trace console
  135.  
  136. * Command modifier flag bits
  137. RXFB_NOIO   EQU   16                   ; suppress I/O inheritance?
  138. RXFB_RESULT EQU   17                   ; result string expected?
  139. RXFB_STRING EQU   18                   ; program is a "string file"?
  140. RXFB_TOKEN  EQU   19                   ; tokenize the command line?
  141. RXFB_NONRET EQU   20                   ; a "no-return" message?
  142.  
  143. * Modifier flags
  144. RXFF_RESULT EQU   1<<RXFB_RESULT
  145. RXFF_STRING EQU   1<<RXFB_STRING
  146. RXFF_TOKEN  EQU   1<<RXFB_TOKEN
  147. RXFF_NONRET EQU   1<<RXFB_NONRET
  148.  
  149. RXCODEMASK  EQU   $FF000000
  150. RXARGMASK   EQU   $0000000F
  151.  
  152. * The RexxRsrc structure is used to manage global resources.
  153. * The name string for each node is created as a RexxArg structure,
  154. * and the total size of the node is saved in the "rr_Size" field.
  155. * Functions are provided to allocate and release resource nodes.
  156. * If special deletion operations are required, an offset and base can
  157. * be provided in "rr_Func" and "rr_Base", respectively.  This function
  158. * will be called with the base in register A6 and the node in A0.
  159.  
  160.          STRUCTURE RexxRsrc,LN_SIZE
  161.          WORD     rr_Func              ; "auto-delete" offset
  162.          APTR     rr_Base              ; "auto-delete" base
  163.          LONG     rr_Size              ; total size of node
  164.          LONG     rr_Arg1              ; available ...
  165.          LONG     rr_Arg2              ; available ...
  166.          LABEL    RRSIZEOF             ; size: 32 bytes
  167. ; Changed from rr_SIZEOF to RRSIZEOF
  168.  
  169. * Field definitions
  170. RRTYPE   EQU      LN_TYPE              ; node type
  171. RRNAME   EQU      LN_NAME              ; node name (argstring)
  172. RRSIZE   EQU      rr_Size              ; total size of node
  173.  
  174. * Resource node types
  175. RRT_ANY  EQU      0                    ; any node type ...
  176. RRT_LIB  EQU      1                    ; a function library
  177. RRT_PORT EQU      2                    ; a public port
  178. RRT_FILE EQU      3                    ; a file IoBuff
  179. RRT_HOST EQU      4                    ; a function host
  180. RRT_CLIP EQU      5                    ; a Clip List node
  181.  
  182. * The RexxTask structure holds the fields used by REXX to communicate with
  183. * external processes, including the client task.  It includes the global
  184. * data structure (and the base environment).  The structure is passed to
  185. * the newly-created task in its "wake-up" message.
  186.  
  187. GLOBALSZ EQU      200                  ; space for the Global Data structure
  188.  
  189.          STRUCTURE RexxTask,GLOBALSZ   ; global data structure
  190.          STRUCT   rt_MsgPort,MP_SIZE   ; message port
  191.          UBYTE    rt_Flags             ; task flag bits
  192.          BYTE     rt_SigBit            ; signal bit
  193.  
  194.          APTR     rt_ClientID          ; the client's task ID
  195.      APTR      rt_MsgPkt           ; the packet being processed
  196.      APTR      rt_TaskID           ; our task ID
  197.      APTR      rt_RexxPort           ; the REXX public port
  198.  
  199.      APTR      rt_ErrTrap           ; Error trap address
  200.      APTR      rt_StackPtr           ; stack pointer for traps
  201.  
  202.      STRUCT   rt_Header1,LH_SIZE
  203.      STRUCT   rt_Header2,LH_SIZE
  204.      STRUCT   rt_Header3,LH_SIZE
  205.      STRUCT   rt_Header4,LH_SIZE
  206.      STRUCT   rt_Header5,LH_SIZE
  207.      LABEL      rt_SIZEOF
  208.  
  209. ENVLIST  EQU      rt_Header1           ; environment list (internal)
  210. FREELIST EQU      rt_Header2           ; freelist (internal)
  211. MEMLIST  EQU      rt_Header3           ; allocation list (external)
  212. FILELIST EQU      rt_Header4           ; I/O files list (external)
  213. PORTLIST EQU      rt_Header5           ; message ports list (external)
  214. NUMLISTS EQU      5
  215.  
  216. * Definitions for RexxTask flag bits
  217. RTFB_TRACE  EQU      0               ; external trace flag
  218. RTFB_HALT   EQU      1               ; external halt flag
  219. RTFB_SUSP   EQU      2               ; suspend task?
  220. RTFB_TCUSE  EQU      3               ; trace console in use?
  221. RTFB_WAIT   EQU      6               ; waiting for reply?
  222. RTFB_CLOSE  EQU      7               ; task completed?
  223.  
  224. * Definitions for memory allocation constants
  225. MEMQUANT EQU      16               ; quantum of memory space
  226. MEMMASK  EQU      $FFFFFFF0           ; mask for rounding the size
  227.  
  228. MEMQUICK EQU      (1<<0)           ; EXEC flags: MEMF_PUBLIC
  229. MEMCLEAR EQU      (1<<16)           ; EXEC flags: MEMF_CLEAR
  230.  
  231. * The SrcNode is a temporary structure used to hold values destined for a
  232. * segment array.  It is also used to maintain the memory freelist.
  233.  
  234.      STRUCTURE SrcNode,0           ; temporary source data structure
  235.      APTR      sn_Succ
  236.      APTR      sn_Pred
  237.      APTR      sn_Ptr           ; pointer value
  238.      LONG      sn_Size           ; size of object
  239.      LABEL      sn_SIZEOF           ; size: 16 bytes
  240.  
  241.      ENDC
  242.